/*
 * $Id: qtcQWidget.cpp 8 2010-11-08 18:49:48Z tfonrouge $
 */

#include "qtharbour.h"

#include <QWidget>

HB_FUNC( QWIDGET_NEW )
{
    xho_ObjParams objParams = xho_ObjParams( NULL );
    
    QWidget* widget = (QWidget *) objParams.paramParent( 1 );
    Qt::WindowFlags flags = (Qt::WindowFlags) hb_parni( 2 );
    
    QPointer<QWidget> mainWindow = new QWidget( widget, flags );
    
    objParams.Return( mainWindow );
}

/* <QTH_GEN> */
HB_FUNC( QWIDGET_ACCEPTDROPS )
{
    QWidget* widget = (QWidget *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( widget )
    {
        hb_retl( widget->acceptDrops() );
    }
}

HB_FUNC( QWIDGET_ACCESSIBLEDESCRIPTION )
{
    QWidget* widget = (QWidget *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( widget )
    {
        qth_retc( widget->accessibleDescription() );
    }
}

HB_FUNC( QWIDGET_ACCESSIBLENAME )
{
    QWidget* widget = (QWidget *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( widget )
    {
        qth_retc( widget->accessibleName() );
    }
}

HB_FUNC( QWIDGET_ACTIVATEWINDOW )
{
    QWidget* widget = (QWidget *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( widget )
    {
        widget->activateWindow();
    }
}

HB_FUNC( QWIDGET_ADDACTION )
{
    QWidget* widget = (QWidget *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( widget )
    {
        widget->addAction( (QAction *) xho_par_XhoObject( 1 ) );
    }
}

HB_FUNC( QWIDGET_ADJUSTSIZE )
{
    QWidget* widget = (QWidget *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( widget )
    {
        widget->adjustSize();
    }
}

HB_FUNC( QWIDGET_AUTOFILLBACKGROUND )
{
    QWidget* widget = (QWidget *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( widget )
    {
        hb_retl( widget->autoFillBackground() );
    }
}

HB_FUNC( QWIDGET_BACKGROUNDROLE )
{
    QWidget* widget = (QWidget *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( widget )
    {
        hb_retni( widget->backgroundRole() );
    }
}

/* </QTH_GEN> */
HB_FUNC( QWIDGET_MOVE )
{
    QWidget* widget = (QWidget *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( widget )
    {
        if( hb_pcount() > 1 )
            widget->move( hb_parni( 1 ), hb_parni( 2 ) );
        else
            widget->move( *(QPoint *) xho_par_XhoObject( 1 ) );
    }
}

HB_FUNC( QWIDGET_RESIZE )
{
    QWidget* widget = (QWidget *) xho_itemListGet_XHO( hb_stackSelfItem() );
    
    if( widget )
    {
        if( hb_pcount() > 1 )
            widget->resize( hb_parni( 1 ), hb_parni( 2 ) );
        else
            widget->resize( *(QSize *) xho_par_XhoObject( 1 ) );
    }
}

HB_FUNC( QWIDGET_SETWINDOWTITLE)
{
    QWidget* widget = (QWidget *) xho_itemListGet_XHO( hb_stackSelfItem() );
    
    if( widget )
    {
        widget->setWindowTitle( qth_parc( 1 ) );
    }
}

HB_FUNC( QWIDGET_SHOW )
{
    QWidget* widget = (QWidget *) xho_itemListGet_XHO( hb_stackSelfItem() );
    
    if( widget )
        widget->show();
}

HB_FUNC( QWIDGET_WINDOWTITLE )
{
    QWidget* widget = (QWidget *) xho_itemListGet_XHO( hb_stackSelfItem() );
    
    if( widget )
    {
        qth_retc( widget->windowTitle() );
    }
}
